package test.bairong;

import java.util.Scanner;

/**
 * @description:
 * @author: w_jingbo
 * @date: 2023/9/23
 * @Copyright: 博客：http://coisini.wang
 */
public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine()) ;
        char[] chars = in.nextLine().toCharArray();
        int res = 0 ;

        int half = n / 2 ;
        for (int i = 0; i < n/2; i++) {
            int j = i + half -1;
            if(iscan(chars,i,j)){
                res++;
            }
        }
        System.out.println(res);
    }

    public static boolean iscan(char[] arr , int i , int j ){
        int num0 = 0 ;
        int num1 = 0 ;
        for (char c : arr) {
            if(c == '0'){
                num0++;
            }else {
                num1++;
            }
        }
        int num00 = 0 ;
        int num11 = 0 ;
        for (int k = i; k <= j; k++) {
            
            if(arr[k] == '0'){
                num00++;
            }else {
                num11++;
            }
        }
        if (num0 == num00 && num1 == num11){
            return true;
        }
        return false;
        
    }
}
